﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace UFPC.Models
{
    [MetadataType(typeof(CustomerProductPriceValidation))]
    public partial class CustomerProductPrice
    {
    }

    public class CustomerProductPriceValidation
    {
        [DisplayFormat(
               ApplyFormatInEditMode = true,
               DataFormatString = "{0:0.00}",
               NullDisplayText = "")]
        [RegularExpression(
                @"\A\d+(\.\d{1,2})?\Z", 
                ErrorMessage = "Please enter a numeric value with up to two decimal places.")]
        public decimal Price { get; set; }
    }
}